﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Composite.Events;
using Microsoft.Practices.Composite.Regions;
using Microsoft.Practices.Composite.Modularity;
using System.ComponentModel;
using ELMWCFServiceClass.ELMWCF;
using SettingModule.Views.FieldSettingView;
using Microsoft.Practices.Unity;
using SettingModule.Views.UserInfoSettingView;
using SettingModule.Views.ELMListConfigView;
using SettingModule.Views.ELMItemsView;

namespace SettingModule.Views.SettingView
{
    public class SettingPresentationModel : ISettingPresentationModel
    {
        private ELMServiceClient _domaincontext;
        private readonly IEventAggregator _eventAggregator;
        private readonly IRegionManager regionManager;
        private readonly IModuleManager moduleManager;
        private readonly IUnityContainer container;
        public SettingPresentationModel(ISettingView view, ELMServiceClient domaincontext, IEventAggregator eventAggregator, IRegionManager regionManage, IModuleManager moduleManager, IUnityContainer container)
        {

            this._domaincontext = domaincontext;
            this._eventAggregator = eventAggregator;
            this.regionManager = regionManage;
            this.moduleManager = moduleManager;
            this.container = container;
            this.View = view;
            regionManager.RegisterViewWithRegion("FieldSetting", () => container.Resolve<IFieldSettingPresentationModel>().View);
            regionManager.RegisterViewWithRegion("ContentTypeSetting", () => container.Resolve<IUserInfoSettingPresentationModel>().View);
            regionManager.RegisterViewWithRegion("ELMListSetting", () => container.Resolve<IELMListConfigPresentationModel>().View);
            regionManager.RegisterViewWithRegion("ELMItemSetting", () => container.Resolve<IELMItemsPrentationModel>().View);


        }
        #region INotifyPropertyChanged Members

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion



        #region ISettingPresentationModel Members

        public ISettingView View
        {
            get;
            set;
        }

        #endregion
    }
}
